﻿<style type="text/css">
    /*列表*/
    body{background: #f2f2f2}
    .mv-content{margin-top: 0px;}
</style>
<div class="mv-tabs-double">
    <a class="odr-fh" onclick="mview.view.load('/views/User/main.html')">
        <i class="iconfont icon-fanhui1"></i>
    </a>
    <div class="odr-nava">
        <a class="choose" onclick="mview.view.load('/views/module/transaction/contractlists.html')">订单</a><a onclick="mview.view.load('/views/module/transaction/billlists.html')">公告</a>
    </div>
    <div class="odr-navb">
        <ul>
            <li>
                <a class="choose" v-on:click="choose($event,0)">全部</a>
            </li>
            <li>
                <a v-on:click="choose($event,1)">待付款</a>
            </li>
            <li>
                <a v-on:click="choose($event,2)">待确认</a>
            </li>
        </ul>
    </div>
</div>
<div class="order-list" style="margin-top:100px;">
    <ul>
        <li v-for="data in bag.datas" v-cloak="">
            <div class="order-cont">
                <div class="order-top">
                    <a href="">
                        <p><i class="iconfont icon-quanbudingdan"></i>
                        <span v-if="data.activeid == data.sellerid" v-text="data.purchaseusername">-</span>
                        <span v-if="data.activeid == data.purchaseid" v-text="data.sellerusername">-</span>
                        <i class="iconfont icon-xiayibu top-i"></i></p>
                        <p v-text="data.statename">-</p>
                    </a>
                </div>
                <div class="order-mid" style="margin-left:-10px;">
                    <div class="mid-cont">
                        <div class="cont-a">
                            <h2 v-if="data.activeid == data.sellerid" v-text="'出售'+data.coincode">-</h2>
                            <h2 v-if="data.activeid == data.purchaseid" v-text="'购买'+data.coincode">-</h2>

                            <p>交易币种：CNY</p>
                        </div>
                        <div class="cont-b">
                            <p v-text="'¥'+data.price">-</p>
                            <p v-text="'x'+data.amount">-</p>
                        </div>
                    </div>
                </div>
                <div class="order-bottom" style="margin-left:-10px;">
                    <a style="border: none;float: left;color: #43527f" v-text="'合计：'+data.total+'¥'">-</a>
                    <a class="mv-btn-blue" v-on:click="detail(data.id)">查看订单</a>
                </div>
            </div>
        </li>
    </ul>
</div>
<div style="text-align:center;margin-top:0.5em;" v-if="bag.dataend == false" v-cloak="">
    <a v-on:click="more" v-text="morename" style="color:#888;">-</a>
</div>
<div style="text-align:center;margin-top:0.5em;" v-if="bag.dataend == true" v-cloak="">
    <a style="color:#aaa;">已显示所有</a>
</div>
<div style="height:60px;"></div>
<script type="text/javascript">
    var pagedata = {
        request: {
            method: "VIEW_TRANSACTION_CONTRACTLISTS",
            state: 0,
            page: 0
        },
        screen: {
            header_display: false,
            footer_choose: "user"
        },
        data: {
            morename: "查看更多"
        },
        methods: {
            detail: function (id) {
                mview.view.load('/views/Module/Transaction/contractdetail.html', {
                    id: id
                });
            },
            choose: function (elm, state) {
                m.view.node(".odr-navb a").removeClass("choose");
                m.view.node(elm.currentTarget).addClass("choose");
                pagedata.request.page = 0;
                pagedata.request.state = state;
                pagedata.reload();
            },
            //加载更多
            more: function () {
                pagedata.request.page += 1;
                mview.socket.send({
                    data: {
                        method: "VIEW_TRANSACTION_CONTRACTLISTS",
                        page: pagedata.request.page,
                        state: pagedata.request.state,
                        part: 1
                    },
                    success: function (json) {
                        if (json.Code == 0 && json.Data.datas.length > 0) {
                            for (var i in json.Data.datas) {
                                var data = json.Data.datas[i];
                                mview.vue.stage.$data.bag.dataend = json.Data.dataend;
                                mview.vue.stage.$data.bag.datas.push(data);
                            }
                        }
                    }
                });
            }
        }
    }
    mview.view.chlid.init(pagedata);
</script>